<template>
  <div class="container cart-cont">
    <!-- 头部渐变背景 -->
    <img
      v-if="fileSpace"
      :src="fileSpace + '/images/submit-bg.png'"
      class="bg-color"
      alt="">
    <div class="cont-main">
      <div class="head-bar mar-t-10">
        <div class="head-box">
          <div class="tab-btn flex" v-if="type === 3">
            <div class="text-align-c flex-item" :class="tabActive === '0' ? 'active' : 'disactive'" @click="tabActiveEls(0)">快递</div>
            <div class="text-align-c flex-item" :class="tabActive === '1' ? 'active' : 'disactive'" @click="tabActiveEls(1)">门店自提</div>
          </div>
          <!-- 快递配送方式的样式 -->
          <div
            class="head-content head-content-post"
            :style="{borderRadius: type === 3 ? '0px 0px 10px 10px': '10px'}"
            v-show="(type === 3 && tabActive === '0') || type === 1" ref="address"
            @click="chooseAddress">
            <div class="flex flex-between">
              <div class="left-box">
                <div v-if="!addressNameStr" class="flex v-align-c">
                  <img
                    v-if="fileSpace"
                    class="width-12 height-12 mar-r-6"
                    :src="fileSpace + '/images/icon-corss-add.png'" alt="">
                  <span class="font-18 font-w font-color-total">新建收货地址</span>
                </div>
                <div class="font-18 font-w font-color memberinfo">
                  <span class="label-ad-sp mar-t-7">
                    <span
                      v-if="memberInfo.addressLabel"
                      class="font-11 width-30 height-15 flex flex-center mar-r-10 font-normal"
                      :class="'label-'+ memberInfo['labelStyle']">
                      <span>{{memberInfo.addressLabel}}</span>
                    </span>
                  </span>
                  <span>{{addressNameStr}}{{memberInfo.communityName}}{{memberInfo.houseNum}}</span>
                </div>
                <div v-if="addressNameStr" class="font-15 mar-t-3 memberinfo">
                  <span>{{memberInfo.receiverName}}</span>
                  <span class="mar-l-6">{{memberInfo.receiverPhone}}</span>
                </div>
              </div>
              <div class="right-box">
                <icon
                  :class="addressNameStr ? '' : 'font-color-total'"
                  class="iconfont icon-arrow-right icon-next-a mar-t-1 mar-r--1 font-16"></icon>
              </div>
            </div>
          </div>
          <!-- 自提配送方式的样式 -->
          <div class="head-content head-content-self" v-show="(type === 3 && tabActive === '1') || type === 2">
            <div class="address-info">
              <div class="font-12 font-color-9">门店地址:</div>
              <div class="font-15 font-w font-color mar-t-5">
                {{memberStore.storeAddress}}
              </div>
              <div class="func-bar font-14 font-color pad-t-16 pad-b-20">
                <div class="flex flex-center" @click="$pt.setClipboardData({data: memberStore.storeAddress})">
                  <img class="width-15 height-15" v-if="fileSpace" :src="fileSpace + '/images/confirm-order-copy.png'" alt="">
                  <span class="mar-l-10">复制地址</span>
                </div>
                <div class="flex flex-center" @click="openLocation">
                  <img class="width-12 height-15" v-if="fileSpace" :src="fileSpace + '/images/finish-address.png'" alt="">
                  <span class="mar-l-10">门店导航</span>
                </div>
              </div>
            </div>
            <div class="flex flex-between mar-t-14">
              <div>营业时间：{{memberStore.businessHour}}</div>
              <div class="flex flex-center relation-phone" @click="$pt.makePhoneCall({phoneNumber: memberStore.storePhone})">
                <img class="width-15 height-15" v-if="fileSpace" :src="fileSpace + '/images/oeder-details-postphone.png'" alt="">
                <span class="mar-l-5 font-color-6">联系卖家</span>
              </div>
            </div>
          </div>
        </div>
      </div>
      <template v-if="addressTips">
        <div class="head-layer-content" :class="'head-' + type">
          <img class="head-arrow width-30 height-50" v-if="fileSpace" :src="fileSpace + '/images/arror-top.png'" alt="">
          <p class="font-14 font-w font-white pad-t-8 pad-b-10">点击这里快递设置收货地址</p>
          <div class="apply-dialog">
            <div class="apply-dialog-info" :class="modal.contentSmall ? 'content-small' : ''" v-html="modal.content"></div>
            <div class="flex bottom-btn">
              <div v-if="modal.cancel" class="flex-item cancel-btn" @click="addressTips = false">{{ modal.cancel }}</div>
              <div v-if="modal.cancel && modal.confirm" class="border-line"></div>
              <div
                v-if="modal.confirm"
                class="flex-item submit-btn"
                :class="modal.confirmActive ? 'submit-apply' : ''"
                @click="showConfirm(modal.confirmType)">{{ modal.confirm }}</div>
            </div>
          </div>
        </div>
        <div class="head-layer-bg"></div>
      </template>
      <div v-if="crossBorderType === 2" class="panel-cb-pl">
        <div class="flex v-align-c pad-b-2">
          <img class="width-15 height-13 mar-r-6" v-if="fileSpace" :src="fileSpace + '/images/icon-codeid-s.png'" alt="">
          <div class="font-13 c-cb-wr">跨境商品需提供付款人信息用以办理清关手续</div>
        </div>
        <div class="pad-l-21 font-15">
          <template v-if="memberInfo.isOpenCertificateInfo">
            <span class="mar-r-21">{{ memberInfo.certificateRealName }}</span>
            <span>{{ memberInfo.certificateNumber }}</span>
          </template>
          <div v-else class="flex v-align-c" @click="chooseCertificate">
            <div class="flex-item">请完善付款人证件信息</div>
            <icon class="iconfont icon-arrow-right icon-next-a mar-t-1 font-16"></icon>
          </div>
        </div>
      </div>    
      <div class="shop-bar">
        <!-- 购物车购买  v-if="isCart"-->
        <div
          v-if="resData.memberStoreTitle"
          class="shop-bar-owner font-16 pad-t-10 pad-b-13 pad-l-10 pad-r-10 mar-b-5">{{ resData.memberStoreTitle }}</div>
        <div class="order-row flex" v-for="(item, index) in listData" :key="index">
          <div class="img-box mar-r-8 pos-rel">
            <!-- 跨境图标 -->
            <div class="cross-border-pic">
              <!-- 跨境保税 -->
              <img
                v-if="fileSpace && item.crossBorderType === 2 && item.crossBorderLabelType === 1"
                :src="fileSpace + '/images/icon-cross-border-s.png'"
                class="icon-cross-border cross-s"
                alt="">
              <!-- 海外直邮 -->
              <img
                v-if="fileSpace && item.crossBorderType === 2 && item.crossBorderLabelType === 2"
                :src="fileSpace + '/images/icon-cross-border-s-22.png'"
                class="icon-cross-border cross-s"
                alt="">
            </div>
            <img v-if="item.goodsImage" :src="item.goodsImage" alt="" class="width-80 height-80">
          </div>
          <div class="width-240 shop-content">
            <div>
              <div class="flex v-align-c">
                <div v-if="item.activityTypeLabel" class="tag-goods flex flex-center" :class="andType ? '' : 'iosType'">
                  <span>{{ item.activityTypeLabel }}</span>
                </div>
                <!-- <div v-if="index === 0" class="tag-goods flex flex-center" :class="andType ? '' : 'iosType'">
                  <span>秒杀</span>
                </div> -->
                <div class="shop-c-line-t font-16 font-color flex-item">                
                  {{item.goodsTitle}}
                </div>
              </div>
              <div class="pad-t-11"></div>
              <div v-if="item.skuDetail" class="font-color-9 font-12">{{item.skuDetail}}</div>
              <div class="font-color-9 font-12 mar-t--2 mar-l--1" v-if="item.deliverySupportFlag === 1">
                <!-- 商品设置会员价处理；有会员价展示权限高于普通正常价格 -->
                <span class="pad-r-13">￥{{ item.bestPrice }}/件</span>
                <span>共{{item.goodsNum}}件</span>
              </div>
            </div>
            <div class="hint-box" v-if="item.deliverySupportFlag !== 1">
              <span>当前收货地址不支持配送该商品</span><span @click="deleteGoods(item)">×</span>
            </div>
          </div>
        </div>
      </div>
      <div class="coupon-box box-layout" @click="couponSelect">
        <span class="font-16">优惠券</span>
        <div class="v-align-c">
          <template v-if="!radio">
            <span class="font-color-9" v-if="useableCoupon === 0">暂无可用优惠券</span>
            <div class="usable-coupon" v-else><span>{{useableCoupon}}张可用</span></div>
          </template>
          <span class="font-color-r" v-else>已选用</span>
          <icon class="iconfont icon-arrow-right icon-next-a mar-t-1 mar-l-5 font-16"></icon>
        </div>
      </div>
      <div class="remark-box box-layout flex v-align-c">
        <span class="font-16 mar-b-1">备注:</span>
        <div class="flex-item">
          <input v-model="memberInfo.comment" class="mar-l-25" maxlength="50" placeholder="选填，填写您的特殊需求" />
        </div>
      </div>
      <div class="amount-box box-layout">
        <div class="flex flex-between">
          <div class="font-color font-16">商品总额</div>
          <div class="font-17 font-w"><span class="font-16 font-normal pad-r-3">¥</span>{{ resData.goodsPriceTotal }}</div>
        </div>
        <div class="font-color flex flex-between mar-t-20" v-if="cashAmount">
          <div class="flex-item v-align-c">
            <div class="coupon-icon flex flex-center font-12 width-17 height-17 mar-r-5">
              <div>券</div>
            </div>
            <div class="font-16">优惠券</div>
          </div>
          <div class="font-red font-17 font-w"><span class="font-16 font-normal pad-r-3">-¥</span>{{resData.couponReduceAmount}}</div>
        </div>
        <!-- 仅快递配送方式需要运费 -->
        <div class="font-color flex flex-between mar-t-20" v-show="(type === 3 && tabActive === '0') || type === 1">
          <div class="font-16">运费</div>
          <!-- <div>{{ freight === '0.00' ? '免运费' : '¥' + freight }}</div> -->
          <div v-if="freight === '0.00'" class="font-16">免运费</div>
          <div v-else class="font-17 font-w"><span class="font-16 font-normal pad-r-3">¥</span>{{ freight }}</div>
        </div>
        <div v-if="crossBorderType === 2 || (resData.taxAmount * 1 > 0)" class="font-color flex flex-between mar-t-20">
          <div class="font-16">税费</div>
          <div class="font-17 font-w"><span class="font-16 font-normal pad-r-3">¥</span>{{ resData.taxAmount }}</div>
        </div>
      </div>    
      <div class="hint-bottom-box" v-if="notSupportNum">
        有<span>{{notSupportNum}}</span>款商品不支持配送,未被计算
      </div>
      <div class="total-bar flex v-align-c pad-l-14 pad-r-14 pad-t-3 pad-b-8">
        <div class="flex-item">
          <div class="flex">
            <div class="font-color-money-all">
              <span class="font-12">￥</span>
              <span class="font-20 font-w">{{ resData.orderTotalPayableAmount }}</span>
            </div>
          </div>
          <div class="font-color-9 font-12 mar-t--6">共{{resData.goodsNum}}件</div>
        </div>
        <div>
          <button
            class="confirm-btn flex flex-center mar-b--5"
            :disabled="disabledPay"
            :class="disabledPay ? 'notSupportSty' : ''"
            @click="payBtnEvent">
            <span>立即支付</span>
          </button>
        </div>
      </div>    
      <!-- 选择优惠券层 -->
      <van-popup
        :show="showCouponAction"
        :safe-area-inset-bottom="false"
        catchtouchmove="true"
        position="bottom"
        @close="closeCouponAction">
        <div class="cb-l-title flex flex-center height-48">
          <h2>优惠券</h2>
          <div class="cb-l-close" @click="closeCouponAction">
            <img
              v-if="fileSpace"
              :src="fileSpace + '/images/icon-close-layer.png'"
              class="width-15 height-15"
              alt="">
          </div>
        </div>
        <div class="height-48"></div>
        <div class="cb-l-main cb-l-coupon-main action-wrap">
          <scroll-view scroll-y="" class="clearfix scroll-main scroll-coupon-main">
            <div class="action-main">
              <van-radio-group :value="radio" @change="onRadioChange">
                <div class="list">
                  <div class="list__item mar-b-15" v-for="(item, index) in availableCoupon" :key="index">
                    <div class="list__wrap">
                      <div :data-name="item.memberCouponId" @click="onCouponClick">
                        <img
                          v-if="fileSpace"
                          :src="fileSpace + '/images/icon-circle-t.png'"
                          class="width-20 height-6 list__coupon-circle-t"
                          alt="">
                        <div class="list__content">
                          <div class="list__left">
                            <div class="list__coupon-wrap">
                              <div class="list__coupon-price mar-t--4">
                                <div class="font-15 mar-r--4 font-w" v-if="item.couponType !== 30">￥</div>
                                <div
                                  v-if="item.couponType === 10"
                                  class="list__price"
                                  :class="{
                                    'list__price-small': (item.cashPriceLength * 1) === 5 || (item.cashPriceLength * 1) === 6,
                                    'list__price-small-m': (item.cashPriceLength * 1) === 7 || (item.cashPriceLength * 1) === 8
                                  }">{{item.cashAmount}}</div>
                                <div
                                  v-if="item.couponType === 20"
                                  class="list__price"
                                  :class="{
                                    'list__price-small': (item.reducePriceLength * 1) === 5 || (item.reducePriceLength * 1) === 6,
                                    'list__price-small-m': (item.reducePriceLength * 1) === 7 || (item.reducePriceLength * 1) === 8
                                  }">{{item.reduceAmount}}</div>
                                <div class="list__price" v-if="item.couponType === 30">{{(item.discountPercent)}}</div>
                                <div class="font-13 mar-b-4" v-if="item.couponType === 30">折</div>
                              </div>
                              <div class="list__requirements font-12 mar-t-2" v-if="item.couponType === 20 || item.couponType === 30">
                                <!-- fullAmountFlag 券使用是否不设门槛 0:设门槛 1：不设门槛 -->
                                <span v-if="item.fullAmount && item.fullAmountFlag !== 1">{{'满' + item.fullAmount + '可用'}}</span>
                                <span v-else>无门槛使用</span>
                              </div>
                              <div class="list__requirements font-12 mar-t-2" v-else>{{item.goodsRange === 1 ? '全部商品' : '部分商品'}}</div>
                            </div>
                          </div>
                          <div class="list__right flex-item">
                            <div class="list__coupon-content">
                              <div class="font-w font-15">{{item.couponName}}</div>
                              <div class="font-2 font-14 mar-t-7">（{{item.couponRemark}}）</div>
                              <div class="font-12 font-color-9 mar-t-11 width-160" v-if="item.validEndTime !== 'today'">{{item.validStartTime}} 至 {{item.validEndTime}}</div>
                              <div class="font-12 mar-t-11" style="color: #EC3B1F;" v-else>今日到期</div>
                            </div>
                            <div class="list__collect--no"><van-radio :name="item.memberCouponId" icon-size="22px" checked-color="#FF593E" /></div>
                          </div>
                        </div>
                      </div>
                      <div
                        v-if="item.projectGoodsList && item.projectGoodsList.length"
                        @click="detailCouponGoods(item)"
                        class="coupon-goods-list pad-t-30 pad-l-16 pad-b-16 mar-t--14 flex v-align-c">
                        <span
                          v-for="(itemC, indexC) in item.projectGoodsList"
                          :key="indexC">
                          <img
                            v-if="itemC.goodsImageUrl"
                            :src="itemC.goodsImageUrl"
                            alt=""
                            class="width-68 height-68 mar-r-10">
                        </span>
                        <div v-if="item.projectGoodsList.length > 4" class="coupon-goods-all font-22 mar-l--4 mar-t--14">...</div>
                      </div>
                    </div>
                  </div>
                </div>
              </van-radio-group>
              <div class="list unusable-list" v-if="unavailableCoupon.length !== 0">
                <div class="unusable-title mar-t-26 mar-b-22">以下优惠券暂不可用({{unavailableCoupon.length}})</div>
                <div class="list__item mar-b-12" v-for="(item, index) in unavailableCoupon" :key="index">
                  <div class="list__wrap">
                    <div class="list__content">
                      <div class="list__left">
                        <!-- <div class="list__border"></div> -->
                        <div class="list__coupon-wrap">
                          <div class="list__coupon-price mar-t--4">
                            <div class="font-15 mar-b-3 mar-r--4 font-w" v-if="item.couponType !== 30">￥</div>
                            <div
                              v-if="item.couponType === 10"
                              class="list__price"
                              :class="{
                                'list__price-small': (item.cashPriceLength * 1) === 5 || (item.cashPriceLength * 1) === 6,
                                'list__price-small-m': (item.cashPriceLength * 1) === 7 || (item.cashPriceLength * 1) === 8
                              }">{{item.cashAmount}}</div>
                            <div
                              v-if="item.couponType === 20"
                              class="list__price"
                              :class="{
                                'list__price-small': (item.reducePriceLength * 1) === 5 || (item.reducePriceLength * 1) === 6,
                                'list__price-small-m': (item.reducePriceLength * 1) === 7 || (item.reducePriceLength * 1) === 8
                              }">{{item.reduceAmount}}</div>
                            <div class="list__price" v-if="item.couponType === 30">{{(item.discountPercent)}}</div>
                            <div class="font-13 mar-b-4" v-if="item.couponType === 30">折</div>
                          </div>
                          <div class="list__requirements font-12 mar-t-2" v-if="item.couponType === 20 || item.couponType === 30">
                            <span v-if="item.fullAmount">{{'满' + item.fullAmount + '可用'}}</span>
                            <span v-else>无门槛使用</span>
                          </div>
                          <div class="list__requirements font-12 mar-t-2" v-else>{{item.goodsRange === 1 ? '全部商品' : '部分商品'}}</div>
                        </div>
                      </div>
                      <div class="list__right flex-item">
                        <div class="list__coupon-content">
                          <div class="font-w font-15">{{item.couponName}}</div>
                          <div class="font-2 font-14 mar-t-7">（{{item.couponRemark}}）</div>
                          <div class="font-12 font-color-9 mar-t-11 width-160" v-if="item.validEndTime !== 'today'">{{item.validStartTime}} 至 {{item.validEndTime}}</div>
                          <div class="font-12 mar-t-11" style="color: #EC3B1F;" v-else>今日到期</div>
                        </div>
                      </div>
                      <!-- <div class="list__arrow--bottom pad-l-10 pad-r-10 mar-r--10"><van-icon name="arrow-down" size="15px" color="#999999" @click.stop="expend = !expend" /></div> -->
                    </div>
                    <div class="list__expend">
                      <ul class="list__ul">
                        <li v-for="(reason, reasonIndex) in item.unavailableReasons" :key="reasonIndex">
                          <div class="round-point"></div>
                          <div>{{reason}}</div>
                        </li>
                      </ul>
                    </div>
                  </div>
                </div>
              </div>
              <div class="pad-10 mar-t-10 align-c" v-if="nodata">
                <img v-if="fileSpace" mode="widthFix" class="width-153 height-75 mar-t-30"
                      :src="fileSpace + '/images/2-0-kong.png'"/>
                <div class="pad-t-20 font-14 font-gray">空空如也</div>
              </div>
            </div>
          </scroll-view>
        </div>
      </van-popup>
      <!-- 跨境详情商品层 -->
      <van-popup
        :show="showDetailCouponGoods"
        :safe-area-inset-bottom="false"
        catchtouchmove="true"
        :overlay="false"
        position="bottom"      
        @close="closeDetailCouponGoods">
        <div class="cb-l-title flex flex-center height-48">
          <h2>商品信息</h2>
          <div class="cb-l-close" @click="closeDetailCouponGoods">
            <img
              v-if="fileSpace"
              :src="fileSpace + '/images/icon-close-layer.png'"
              class="width-15 height-15"
              alt="">
          </div>
        </div>
        <div class="height-48"></div>
        <div class="cb-l-main">
          <scroll-view scroll-y="" class="clearfix scroll-main">
            <div class="pad-l-15 pad-r-15">
              <ul class="cb-l-list">
                <li
                  v-for="(itemL, indexL) in cbItemData"
                  :key="indexL"
                  class="flex v-align-t pad-t-11 pad-b-12">
                  <img
                    v-if="itemL.goodsImageUrl"
                    :src="itemL.goodsImageUrl"
                    class="width-80 height-80 border-radius-10 mar-r-8"
                    alt="">
                  <div class="flex-item">
                    <div class="pad-t-2"></div>
                    <h4 class="font-normal font-16 detail-cb-title">{{ itemL.title }}</h4>
                    <div class="flex v-align-b pad-t-28">
                      <div class="flex-item font-12 font-color-9">
                        <div>单价：￥{{ itemL.bestPrice }}</div>
                        <div class="mar-t--4">数量：{{ itemL.goodsNum }}</div>
                      </div>
                      <div class="font-16 font-w font-color-money mar-b--2"><span class="font-11">¥ </span>{{ itemL.goodsSubTotalAmount }}</div>
                    </div>
                  </div>
                </li>
              </ul>
            </div>
          </scroll-view>
        </div>
      </van-popup>    
    </div>
  </div>
</template>

<script>
  import {
    submitOrder,
    getOrderCheck
  } from '@/api/shop'
  import Coupon from '@/components/Coupon'
  import { getAddress } from '@/api/address'
  import { checkMyCoupon } from '@/api/personal'
  import { listEnterpriseMessageConfig } from '@/api/common'
  import GetFormId from '@/components/GetFormId'
  import { throttle } from '@/utils'

  export default {
    components: { GetFormId, Coupon },
    data() {
      return {
        address: '',
        addressNameStr: '',
        memberInfo: {
          addressId: '',
          receiverName: '',
          receiverPhone: '',
          addressName: '',
          address: '',
          comment: ''
        },
        sellerInfo: {},
        resData: {},
        goods: {
          goodsId: '',
          goodsNum: 1,
          skuId: '',
          skuDetail: ''
        },
        shareSkuDetail: '',
        goodsType: null,
        freight: 0,
        listData: [],
        isCart: false,
        cartIds: [],
        shareMemberId: null,
        submitStatus: false,
        memberStore: {}, // 店铺信息
        type: '2', // this.type = 1为仅快递类型；this.type = 2为仅自营自提类型；this.type = 3为都支持类型（快递+自营自提）
        tabActive: '0',
        totalPrice: 0,
        room_id: '',
        showCouponAction: false,
        expend: false,
        radio: '',
        availableCoupon: [],
        unavailableCoupon: [],
        useableCoupon: 0,
        userCouponIndex: -1,
        nodata: false,
        messageIds: [],
        globalStyle: {},
        addressTips: false,
        modal: {},
        notSupportNum: 0, // 有几款商品不支持配送
        disabledPay: false,
        andType: false,
        showDetailCouponGoods: false,
        crossBorderType: null,
        cbItemData: [],
        viewBoolean: false
      }
    },
    computed: {
      total() {
        let total = 0
        this.listData.forEach(item => {
          total = item.deliverySupportFlag === 1 ? (total * 1 + item.bestPrice * item.goodsNum).toFixed(2) : total * 1 + 0
        })
        if ((this.type === 3 && this.tabActive === '0') || this.type === 1) {
          total = (total * 1 + this.freight * 1).toFixed(2)
        }
        if (this.cashAmount) {
          // 如果优惠券满减金额大于订单金额
          if ((total * 1 - this.cashAmount * 1) >= 0) {
            total = (total * 1 - this.cashAmount * 1).toFixed(2)
          } else {
            total = (this.freight * 1).toFixed(2) || '0.00'
          }
        }
        if (!this.$utils.isNumber(total)) total = 0
        this.totalPrice = total
        return total
      },
      cashAmount() {
        this.userCouponIndex = this.availableCoupon.findIndex(item => {
          return item.memberCouponId === this.radio
        })
        if (this.userCouponIndex !== -1) {
          let value = this.availableCoupon[this.userCouponIndex]
          let reducePrice = ''
          switch (value.couponType) {
            case 10:
              reducePrice = value.cashAmount
              break
            case 20:
              reducePrice = value.reduceAmount
              break
            case 30:
              reducePrice = value.discountAmount
              break
            default:
              break
          }
          return reducePrice
        } else {
          return ''
        }
      }
    },
    onLoad() {
      // 初始化data
      Object.assign(this.$data, this.$options.data())
    },
    // onReady() {
    //   this.init()
    // },
    onShow() {
      wx.setNavigationBarColor({
        frontColor: '#ffffff',
        backgroundColor: '#fe2c44'
      })
      if (this.viewBoolean) return
      // 清楚证件信息拷贝缓存设置
      this.$pt.removeStorageSync('copyRealInfo')
      this.init()
    },
    onHide() {
      this.$pt.removeStorageSync('addressId')
    },
    onUnload() {
      this.$pt.removeStorageSync('addressId')
    },
    mounted() {
      let sysInfo = ''
      sysInfo = this.$pt.getSystemInfoSync()
      if (sysInfo.system.indexOf('iOS') === -1) {
        // android类型
        this.andType = true
      } else {
        this.andType = false
      }
    },
    methods: {
      closeCouponAction() {
        this.showCouponAction = false
      },
      closeDetailCouponGoods() {
        this.showDetailCouponGoods = false
      },
      detailCouponGoods(item) {
        this.showDetailCouponGoods = true
        if (item.projectGoodsList && item.projectGoodsList.length) {
          this.cbItemData = []
          this.cbItemData = item.projectGoodsList
        }
        console.log('showDetailCouponGoods item 11', item)
      },
      async init() {
        this.$utils.showToast({
          title: '加载中',
          icon: 'loading'
        })
        let getAppInfo = this.$pt.getStorageSync('appInfo')
        this.globalStyle = getAppInfo.style
        this.shareMemberId = this.getCurrentPage().query.shareMemberId || this.$store.state.shareMemberId
        this.room_id = this.getCurrentPage().query.room_id
        this.$pt.removeStorageSync('pageBuyFrom')
        if (this.$pt.getStorageSync('addressId')) {
          this.addressTips = false
          await this.addressGetEls(this.$pt.getStorageSync('addressId'))
        }
        this.messageConfig()
        this.initShoppingCart()
        setTimeout(() => {
          this.$pt.hideToast()
        }, 1000)
        this.modal = {
          content: '<p>您当前没有任何收货地址信息</p><p>是否前往设置收货地址？</p>',
          cancel: '取消',
          confirm: '立即前往',
          confirmActive: true,
          confirmType: 1
        }
      },
      tabActiveEls(val) {
        if (val === Number(this.tabActive)) return
        this.$utils.showToast({
          title: '加载中',
          icon: 'loading'
        })
        if (val === 0) {
          this.tabActive = '0'
          this.addressTipsEls()
        } else {
          this.tabActive = '1'
          this.addressTips = false
        }
        this.initMemberInfo()
      },
      showConfirm(val) {
        if (val === 1) {
          this.chooseAddress()
        }
      },
      // 删除收货不支持配送的 货品
      deleteGoods(goods) {
        this.cartIds = Array.from(new Set(this.cartIds))
        let index = this.cartIds.indexOf(goods.cartId)
        if (index > -1) {
          this.cartIds.splice(index, 1)
        }
        if (this.cartIds.length !== 0) {
          this.initMemberInfo()
        } else {
          this.$pt.navigateBack({detail: -1})
        }
        this.radio = ''
      },
      messageConfig() {
        this.messageIds = []
        const dataArr = ['1101', '1103', '1401']
        let dataStr = dataArr.toString()
        listEnterpriseMessageConfig({
          memberId: this.getMemberId,
          ascriptionTypes: dataStr
        }).then((response) => {
          if (response.isError) return
          response.data.forEach(item => {
            if (item.miniMadeId) {
              this.messageIds.push(item.miniMadeId)
            }
          })
        }).catch(() => {
        })
      },
      addressGetEls(addressId) {
        return new Promise((resolve, reject) => {
          getAddress(addressId).then((response) => {
            if (response.isError) return
            this.memberInfo.addressId = addressId
            this.$pt.removeStorageSync('addressId')
            resolve(true)
            // this.memberInfo.receiverName = response.data.receiverName
            // this.memberInfo.receiverPhone = response.data.receiverPhone
            // this.address = response.data.addressName + ' ' + response.data.address
          }).catch(() => {
          })
        })
      },
      onRadioChange(e) {
        // console.log('我点击单选按钮：', e.mp.detail, 'radio:', this.radio)
        // this.radio = e.mp.detail
        // this.showCouponAction = false
      },
      onCouponClick(e) {
        const {name} = e.currentTarget.dataset
        if (this.radio === name) {
          // 如果点击选中优惠券 则为取消
          this.radio = ''
          this.initMemberInfo()
          return
        }
        this.radio = name
        this.showCouponAction = false
        this.initMemberInfo()
      },
      addressTipsEls() {
        if ('addressName' in this.memberInfo) {
          this.addressTips = false
        } else {
          this.addressTips = true
        }
      },
      couponFailLayer() {
        this.$pt.showModal({
          title: '温馨提示',
          content: '当前选择的优惠券已失效\r\n请重新选择优惠券',
          confirmText: '朕知道了',
          showCancel: false,
          success(res) {
            if (res.confirm) {
              console.log('朕知道了')
            }
          }
        })
      },
      initMemberInfo() {
        // console.log('coupon aa', this.userCouponIndex, this.availableCoupon.length, this.availableCoupon)
        let fromType = 0
        this.goodsType = Number(this.getCurrentPage().query.goodsType)
        if (this.isCart) {
          fromType = 3
        } else if (this.goodsType === 10) {
          fromType = 1
        } else if (this.goodsType === 30 || this.goodsType === 31 || this.goodsType === 32) {
          fromType = 2
        }
        // fromType 核对页面来源(1.商品详情页 2.分销商品详情页 3.购物车)
        // 1：快递配送 2: 门店自提'  3:'社区团购' 4:'到家自提' 5:'到家配送
        let params = {
          fromType: fromType,
          memberId: this.getMemberId,
          customerId: this.getCustomerId,
          cartIds: this.cartIds,
          goodsId: this.getCurrentPage().query.goodsId,
          skuId: this.getCurrentPage().query.skuId,
          goodsNum: this.getCurrentPage().query.goodsNum,
          addressId: this.memberInfo.addressId || this.$pt.getStorageSync('addressId'),
          memberCouponId: this.radio,
          deliveryType: Number(this.tabActive) + 1
        }
        if (!this.getShowBuyCard) {
          params.customerId = this.getMemberId
        }
        // console.log('params', params)
        return getOrderCheck(params).then((response) => {
          if (response.isError) {
            this.notSupportNum = 1
            this.disabledPay = true
            return
          }
          // 优惠券失效层
          // this.couponFailLayer()
          if (response.data.address) {
            this.memberInfo = response.data.address
            if ('addressLabel' in this.memberInfo) {
              let label = ''
              switch (this.memberInfo.addressLabel) {
                case '公司':
                  label = 1
                  break
                case '家':
                  label = 2
                  break
                case '其他':
                  label = 3
                  break
                case '学校':
                  label = 4
                  break
              }
              this.memberInfo.labelStyle = label
            }
          }
          if ('addressName' in this.memberInfo) {
            this.addressNameStr = this.memberInfo.addressName.replace(/\s*/g, '')
            this.address = this.addressNameStr + ' ' + this.memberInfo.address
          }
          // console.log('核对订单信息', response.data)
          this.resData = response.data
          if (this.isCart) {
            this.listData = response.data.goodsList
            if (this.listData.length && this.listData[0].crossBorderType === 2) {
              this.crossBorderType = 2
            } else {
              this.crossBorderType = null
            }
            // 获取有几款商品不支持配送
            let temp = response.data.goodsList.filter(item => {
              return item['deliverySupportFlag'] === 0
            })
            this.notSupportNum = temp.length
          } else {
            this.listData = response.data.cartList
            if (this.listData.length && this.listData[0].crossBorderType === 2) {
              this.crossBorderType = 2
            } else {
              this.crossBorderType = null
            }
            // 获取有几款商品不支持配送
            let temp = response.data.cartList.filter(item => {
              return item['deliverySupportFlag'] === 0
            })
            this.notSupportNum = temp.length
          }
          if (!this.notSupportNum) {
            this.disabledPay = false
          } else {
            this.disabledPay = true
          }
          this.addressTipsEls()
          this.$pt.removeStorageSync('certificateSelect')
          if (this.memberInfo && this.crossBorderType === 2 && !this.memberInfo.isOpenCertificateInfo && (!this.memberInfo.certificateRealName || !this.memberInfo.certificateNumber)) {
            this.disabledPay = true
          }
          this.memberStore = response.data.memberStore
          this.freight = response.data.postFee
          // 用来判断商品的配送方式
          let pickUp = this.listData.filter(item => item.pickUpFlag === 1)
          let express = this.listData.filter(item => item.expressFlag === 1)
          if (pickUp.length && express.length) {
            this.type = 3
          } else if (pickUp.length && !express.length) {
            this.type = 2
            this.addressTips = false
          } else if (!pickUp.length && express.length) {
            this.type = 1
          }
          let tempList = []
          if (this.tabActive === '0') {
            tempList = this.listData.filter(item => item.expressFlag === 1)
          } else {
            tempList = this.listData.filter(item => item.pickUpFlag === 1)
          }
          this.listData = tempList
          // 调用我的优惠券接口
          if (!this.getShowBuyCard) return true
          this.checkMyCoupon()
          this.$pt.hideToast()
          return true
        }).catch(() => {
          this.$pt.hideToast()
        })
      },
      initShoppingCart() {
        const strCartIds = this.getCurrentPage().query.cartIds
        // const strCartIds = '1452909746721058817,1452905589549232130,1453646303891488769'
        // const strCartIds = '1452909746721058817,1452905589549232130'
        if (strCartIds) {
          strCartIds.split(',').forEach((item) => {
            if (item) this.cartIds.push(item)
          })
        }
        this.cartIds = Array.from(new Set(this.cartIds))
        // console.log('购物车cardIds', this.cartIds)
        if (this.cartIds.length === 0) {
          this.initMemberInfo()
          return false
        } else {
          this.isCart = true
        }
        this.initMemberInfo()
      },
      payBtnEvent() {
        throttle(this.submitPay, 1000)
      },
      submitPay() {
        this.$utils.showToast({
          title: '加载中',
          icon: 'loading'
        })
        if (!this.getShowBuyCard) {
          this.$utils.showToast({title: '已购买成功！'})
          setTimeout(() => {
            this.$pt.reLaunch({url: '/pages/home/main'})
          }, 1000)
          return
        }
        let that = this
        let rejectArr = []
        if (!this.messageIds.length) {
          this.submitOrder()
          return
        }
        this.$pt.requestSubscribeMessage({
          tmplIds: that.messageIds,
          success: function(res) {
            // 成功
            Object.keys(res).forEach(key => {
              if (res[key] === 'reject') {
                rejectArr.push(key)
              }
            })
            if (rejectArr.length) {
              that.messageIds = rejectArr
              that.$utils.showToast({title: '请允许消息通知！'})
            } else {
              that.submitOrder()
            }
          },
          fail(err) {
            // 失败
            that.$utils.showToast({title: '消息订阅失败，' + err.errCode})
            console.error(err)
          }
        })
      },
      submitOrder() {
        this.$pt.hideToast()
        this.$pt.removeStorageSync('pageBuyFrom')
        // console.log('submitOrder, shareMemberId: ' + this.shareMemberId)
        if (this.submitStatus) {
          return
        }
        this.submitStatus = true
        // 判断是否为快递配送方式下提交的订单
        // this.memberInfo.address = this.address
        // this.type = 1为仅快递类型；this.type = 2为仅自营自提类型；this.type = 3为都支持类型（快递+自营自提）
        if ((this.type === 3 && this.tabActive === '0') || this.type === 1) {
          if (!this.address && this.goodsType !== 20) {
            this.$utils.showToast({ title: '收货地址不能为空' })
            this.submitStatus = false
            return
          }
        }
        // if (this.address && this.crossBorderType === 2 && !this.address.isOpenCertificateInfo && (!this.address.certificateRealName || !this.address.certificateNumber)) {
        //   this.submitStatus = false
        //   return
        // }
        let goodsList = []
        let projectGoodsList = []
        // console.log(this.listData)
        this.listData.forEach((item) => {
          // 判断下单页面来源
          if (item.goodsType === 30) {
            projectGoodsList.push({
              goodsId: item.goodsId,
              goodsNum: item.goodsNum,
              skuId: item.skuId,
              goodsType: item.goodsType
            })
          } else {
            goodsList.push({
              goodsId: item.goodsId,
              goodsNum: item.goodsNum,
              skuId: item.skuId,
              goodsType: item.goodsType
            })
          }
        })
        let deliveryType = 0
        if ((this.type === 3 && this.tabActive === '0') || this.type === 1) {
          // 快递配送
          deliveryType = 1
        } else if ((this.type === 3 && this.tabActive === '1') || this.type === 2) {
          // 自提
          deliveryType = 2
        }
        // console.log('我在结算页面:', this.room_id)
        const params = {
          memberId: this.getMemberId,
          customerMemberId: this.getCustomerId,
          customerNickname: this.memberInfo.receiverName,
          customerPhone: this.memberInfo.receiverPhone,
          customerAddress: this.memberInfo.address,
          addressId: this.memberInfo.addressId,
          customerComment: this.memberInfo.comment,
          cartIds: this.cartIds,
          goodsList: goodsList,
          deliveryType: deliveryType,
          projectGoodsList: projectGoodsList,
          roomId: this.room_id,
          memberCouponId: this.radio
        }
        if (!this.getShowBuyCard) {
          params.customerMemberId = this.getMemberId
        }
        if (this.shareMemberId && this.getCustomerId !== this.getMemberId) {
          params.shareMemberId = this.shareMemberId
        }
        if (this.$pt.getStorageSync('flowNo')) {
          params.flowNo = this.$pt.getStorageSync('flowNo')
        }
        submitOrder(params).then((response) => {
          if (response.isError) {
            this.submitStatus = false
            return
          }
          const that = this
          const payParams = response.data
          // 如果订单金额为1的时候不用支付，直接跳转至订单支付成功页面
          if (payParams.orderStatus === 1) {
            switch (payParams.orderGoodsDeliveryType) {
              case 10: // 微店商品快递配送
                that.$pt.reLaunch({url: '/pages/shop/result/main?successFlag=1&price=' + that.resData.orderTotalPayableAmount +
                  '&orderId=' + payParams.orderId + '&resType=' + payParams.orderGoodsDeliveryType})
                break
              case 11: // 微店商品门店自提
                that.$pt.reLaunch({url: '/pages/shop/result/main?successFlag=1&price=' + that.resData.orderTotalPayableAmount +
                  '&orderId=' + payParams.orderId + '&resType=' + payParams.orderGoodsDeliveryType})
                break
              case 20: // 分销商品快递配送
                that.$pt.reLaunch({url: '/pages/shop/result/main?successFlag=1&price=' + that.resData.orderTotalPayableAmount +
                  '&orderId=' + payParams.orderId + '&resType=' + payParams.orderGoodsDeliveryType})
                break
              case 30: // 微店商品+分销商品快递配送
                that.$pt.reLaunch({url: '/pages/personal/order/customer-order/main'})
                break
              default:
                break
            }
            that.submitStatus = false
            return
          }
          that.viewBoolean = true
          that.$pt.requestPayment(
            {
              'timeStamp': payParams.timeStamp,
              'nonceStr': payParams.nonceStr,
              'package': payParams.package,
              'signType': payParams.signType,
              'paySign': payParams.paySign,
              'success': function(res) {
                // that.$store.commit('setShareMemberId', '')
                switch (payParams.orderGoodsDeliveryType) {
                  case 10: // 微店商品快递配送
                    that.$pt.reLaunch({url: '/pages/shop/result/main?successFlag=1&price=' + that.resData.orderTotalPayableAmount +
                      '&orderId=' + payParams.orderId + '&resType=' + payParams.orderGoodsDeliveryType})
                    break
                  case 11: // 微店商品门店自提
                    that.$pt.reLaunch({url: '/pages/shop/result/main?successFlag=1&price=' + that.resData.orderTotalPayableAmount +
                      '&orderId=' + payParams.orderId + '&resType=' + payParams.orderGoodsDeliveryType})
                    break
                  case 20: // 分销商品快递配送
                    that.$pt.reLaunch({url: '/pages/shop/result/main?successFlag=1&price=' + that.resData.orderTotalPayableAmount +
                      '&orderId=' + payParams.orderId + '&resType=' + payParams.orderGoodsDeliveryType})
                    break
                  case 30: // 微店商品+分销商品快递配送
                    that.$pt.reLaunch({url: '/pages/personal/order/customer-order/main'})
                    break
                  default:
                    break
                }
                setTimeout(() => {
                  that.submitStatus = false
                }, 3000)
              },
              'fail': function(res) {
                switch (payParams.orderGoodsDeliveryType) {
                  case 10: // 微店商品快递配送
                    that.$pt.reLaunch({url: '/pages/shop/result/main?successFlag=0&price=' + that.resData.orderTotalPayableAmount +
                      '&orderId=' + payParams.orderId + '&resType=' + payParams.orderGoodsDeliveryType})
                    break
                  case 11: // 微店商品门店自提
                    that.$pt.reLaunch({url: '/pages/shop/result/main?successFlag=0&price=' + that.resData.orderTotalPayableAmount +
                      '&orderId=' + payParams.orderId + '&resType=' + payParams.orderGoodsDeliveryType})
                    break
                  case 20: // 分销商品快递配送
                    that.$pt.reLaunch({url: '/pages/shop/result/main?successFlag=0&price=' + that.resData.orderTotalPayableAmount +
                      '&orderId=' + payParams.orderId + '&resType=' + payParams.orderGoodsDeliveryType})
                    break
                  case 30: // 微店商品+分销商品快递配送
                    that.$pt.reLaunch({url: '/pages/personal/order/customer-order/main'})
                    break
                  default:
                    break
                }
                setTimeout(() => {
                  that.submitStatus = false
                }, 3000)
              }
            })
        }).catch(() => {
        })
      },
      openLocation() {
        // 获取位置
        if (!this.memberStore.latitude || !this.memberStore.longitude) {
          return
        }
        this.viewBoolean = true
        this.$pt.openLocation({
          latitude: Number(this.memberStore.latitude),
          longitude: Number(this.memberStore.longitude),
          address: this.memberStore.storeAddress
        })
      },
      chooseAddress() {
        // console.log('chooseAddress els')
        this.$pt.setStorageSync('pageBuyFrom', true)
        this.$pt.navigateTo({url: '/pages/personal/address/main'})
      },
      chooseCertificate() {
        if (this.memberInfo && this.memberInfo.addressName) {
          console.log('this.memberInfo 111', this.memberInfo)
          this.saveAddress(this.memberInfo)
        } else {
          this.chooseAddress()
        }
      },
      saveAddress(address) {
        this.$pt.setStorageSync('addressDetail', true)
        this.$pt.setStorageSync('certificateSelect', true)
        let addressData = {
          addressId: address.addressId,
          defaultFlag: address.defaultFlag || '',
          communityName: address.communityName,
          receiverName: address.receiverName,
          receiverPhone: address.receiverPhone,
          address: address.address,
          houseNum: address.houseNum || '',
          provinceName: address.provinceName,
          cityName: address.cityName,
          districtName: address.districtName
        }
        if (address.isOpenCertificateInfo) {
          addressData.isOpenCertificateInfo = address.isOpenCertificateInfo
          addressData.certificateRealName = address.certificateRealName
          addressData.certificateType = address.certificateType
          addressData.certificateNumber = address.certificateNumber
        }
        this.$pt.navigateTo({ url: '/pages/personal/address/saveAddress/main?addressObj=' + JSON.stringify(addressData) })
      },
      couponSelect() {
        // 优惠券点击弹窗
        // if (this.availableCoupon.length !== 0) {
        //   this.radio = this.availableCoupon[0].memberCouponId
        //   console.log('radioValue:', this.radio)
        // }
        this.showCouponAction = true
      },
      selectCoupon(item) {
        // console.log('我点了优惠券', this.radio, 'sss:', item.memberCouponId)
        // 选择优惠券
        if (this.radio === item.memberCouponId) {
          this.radio = ''
          return
        }
        this.radio = item.memberCouponId
      },
      checkMyCoupon() {
        let params = {
          memberId: this.getMemberId,
          customerMemberId: this.getCustomerId,
          projectGoodsList: []
        }
        // 对商品列表进行循环
        this.listData.forEach(item => {
          params.projectGoodsList.push({
            goodsId: item.goodsId,
            skuId: item.skuId || '',
            goodsNum: item.goodsNum,
            goodsType: item.goodsType,
            bestPrice: item.bestPrice
          })
        })
        this.nodata = false
        checkMyCoupon(params).then(response => {
          if (response.isError) return
          // this.availableCoupon = response.data.availableCoupon
          // this.unavailableCoupon = response.data.unavailableCoupon
          let available = response.data.availableCoupon
          let unavailable = response.data.unavailableCoupon
          this.useableCoupon = available.length
          if (available.length === 0 && unavailable.length === 0) {
            this.nodata = true
            return
          }
          available.forEach(item => {
            item.validStartTime = item.validStartTime.split(' ')[0]
            item.validEndTime = this.isToday(item.validEndTime)
            if (item.cashAmount) {
              item.cashAmount = parseFloat(item.cashAmount)
              item.cashPriceLength = item.cashAmount.toString().length
            }
            if (item.reduceAmount) {
              item.reduceAmount = parseFloat(item.reduceAmount)
              item.reducePriceLength = item.reduceAmount.toString().length
            }
            if (item.discountPercent) item.discountPercent = parseFloat(item.discountPercent)
          })
          unavailable.forEach(item => {
            item.validStartTime = item.validStartTime.split(' ')[0]
            item.validEndTime = this.isToday(item.validEndTime)
            if (item.cashAmount) {
              item.cashAmount = parseFloat(item.cashAmount)
              item.cashPriceLength = item.cashAmount.toString().length
            }
            if (item.reduceAmount) {
              item.reduceAmount = parseFloat(item.reduceAmount)
              item.reducePriceLength = item.reduceAmount.toString().length
            }
            if (item.discountPercent) item.discountPercent = parseFloat(item.discountPercent)
          })
          this.availableCoupon = available
          this.unavailableCoupon = unavailable
        }).catch(() => {
        })
      },
      isToday(date) {
        let today = new Date().toLocaleDateString()
        let tsDate = date.split(' ')[0].replace(/-/g, '/')
        if (new Date(tsDate).getTime() === new Date(today).getTime()) {
          return 'today'
        }
        return date.split(' ')[0]
      }
    }
  }
</script>

<style lang='less' scoped>
@light-orange: #FF593E;
@drak-orange: #EC3B1F;
.coupon-goods-list{
  background: #f9f9f9;
  border-radius: 8px;
}
.coupon-goods-all{
  color: #C2C2C2;  
}
.coupon-icon{
  background: #ff243d;
  color: #fff;
  border-radius: 2px;
  // >div{
  //   margin-top: -2px;
  // }
}
.panel-cb-pl{
  background: #fff;
  border-radius: 10px;
  padding: 13px 15px 11px 15px;
  margin-top: 10px;
}
.c-cb-wr{
  color: #FF243D;
}
.tag-goods{
  font-style: italic;
  font-weight: normal;
  color: #fff;
  font-size: 12px;
  margin-right: 5px;
  margin-bottom: -2px;
  box-sizing: border-box;
  width: 37px;
  height: 18px;
  line-height: unset!important;
  background: url('https://veekrayimg.joinsun.vip/images/shop-tag.png') no-repeat;
  // background: #ec3b1f;
  background-size: 100% 100%;
  &.iosType{
    span{
      margin-bottom: -2px;
    }
  }
  span{
    margin-left: -5px;
  }
}
.shop-bar-owner{
  border-bottom: #f5f5f5 1px solid;
}
.icon-next-a{
  color: #898989;
}
.label-ad-sp{
  display: inline-block;
  vertical-align: top;
}
.label-2{
  background: #FFEAEC;
  border-radius: 3px;
  color: #FF243D;
}
.label-3 {
  background: #FFEAEC;
  border-radius: 3px;
  color: #FF243D;
}
.label-1 {
  background: #E6F0FF;
  border-radius: 3px;
  color: #0066FF;
}
.label-4 {
  background: #EBEDFF;
  border-radius: 3px;
  color: #7427FF;
}
.shop-c-line-t{
  height: 20px;
  line-height: 1.3;
  overflow:hidden;
  text-overflow:ellipsis;
  display:-webkit-box;
  -webkit-line-clamp:1;
  -webkit-box-orient:vertical;
  word-break:break-word;
}
.goods-title {
  height: 25px;
  overflow: hidden;
}
.img-item {
  width: 70px;
  height: 70px;
  border-radius: 2px;
}
.bottom-btn {
  width: 100%;
  height: 45px;
  position: fixed;
  bottom: 0;
  background-color: #fff;
  z-index: 990;
}
.total {
  width: 60%;
}
.submit {
  width: 40%;
  color: #fff;
  background-color: red;
}
.get-form-id {
  position: absolute;
  width:150px;
  height:40px;
  z-index: 999;
}
.container {
  padding-left: 14px;
  padding-right: 14px;
  box-sizing: border-box;
  .bg-color {
    height: 190px;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: -1;
  }
}
.cont-main{
  padding: 0 0 125px 0;
  width: unset;
  position: relative;
  .bg-color {
    height: 190px;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: -1;
  }
  .head-layer-content{
    position: fixed;
    left: 0;
    top: 120px;
    width: 100%;
    height: 100%;
    text-align: center;
    z-index: 30;
    &.head-3{
      top: 165px;
    }
    .head-arrow{
      display: block;
      margin: 0 auto;
    }
    .apply-dialog{
      background-color: white;
      width: 290px;
      margin: 0 auto;
      border-radius: 8px;
      overflow: hidden;
      line-height: 1;
      position: relative;
      z-index: 2100;
      text-align: center;
      .apply-dialog-head{
        height: 37px;
        width: 37px;
        border-radius: 50%;
        display: block;
        margin: 16px auto 0 auto;
      }
      .apply-dialog-title{
        text-align: center;
        color: #343434;
        font-size: 15px;
      }
      .apply-dialog-t-short{
        text-align: center;
        color: #666;
        font-size: 15px;
        font-weight: bold;
      }
      .apply-dialog-info{
        display: flex;
        flex-direction: column;
        align-items: center;
        // justify-content: center;
        color: #666;
        padding: 26px 0 0 0;
        box-sizing: border-box;
        line-height: 1.5;
        min-height: 136px;
        width: 100%;
        border-radius: 5px;
        margin: 0px auto;
        &.content-small{
          font-size: 11px;
          color: #b5b5b5;
        }   
      }
      .bottom-btn{
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        border-top: #f6f6f6 1px solid;    
        .cancel-btn{
          background-color: #fff;
          color: #666;
          font-size: 16px;
          height: 44px;
          line-height: 44px;
          text-align: center;
        }
        .submit-btn{
          background-color: #fff;
          color: #666;
          font-size: 16px;
          height: 44px;
          line-height: 44px;
          text-align: center;
          &.submit-apply{
            color: #333;
          }
        }
        .border-line{
          width: 1px;
          background-color: #f6f6f6;
        }
      }
    }
  }  
  .head-layer-bg{
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    background: rgba(0, 0, 0, 0.6);
  }
  .head-bar{
    position: relative;
    z-index: 21;
    // .head-box{
    //   border-radius: 7px;
    //   overflow: hidden;
    //   .head-tabs{
    //     display: flex;
    //     justify-content: center;
    //     align-items: center;
    //     background-size: 100%;
    //     background-repeat: no-repeat;
    //     height: 45px;
    //     .head-tab{
    //       width: 50%;
    //       height: 45px;
    //       line-height: 45px;
    //       text-align: center;
    //     }
    //   }
    //   .tab-post{
    //     background-image: url('https://veekrayimg.joinsun.vip/images/order-details-tab-1.png');
    //   }
    //   .tab-self{
    //     background-image: url('https://veekrayimg.joinsun.vip/images/order-details-tab-2.png');
    //   }
    // }
    .tab-btn {
      height: 38px;
      border-radius: 10px 10px 0px 0px;
      background: #FFF2F2;
      &>div:nth-child(1) {
        left: 0px;
      }
      &>div:nth-child(2) {
        right: 0px;
      }
      .active {
        font-size: 18px;
        color: #000;
        font-weight:bold ;
        border-radius: 10px 10px 0px 0px !important;
        padding-top: 8px;
        padding-bottom: 10px;
        margin-top: -8px;
        background: #fff;
      }
      .disactive {
        font-size: 15px;
        color: #000;
        font-weight: 500;
        background: #FFF2F2;
        padding-top: 7px;
        padding-bottom: 7px;
        border-radius: 10px;
      }
    }
    .head-content{
      background: white;
    }
    .head-content-post{
      padding: 12px 16px;
      .left-box{
        .memberinfo{
          min-height: 24px;
        }
      }
    }
    .head-content-self{
      padding: 14px 8px 15px;
      .address-info{
        border-bottom: 1px solid #ededed;
        .func-bar{
          display: flex;
          justify-content: space-around;
          align-items: center;
        }
      }
      .relation-phone{
        padding: 5px 13px 5px 11px;
        border: 1px solid #ededed;
        border-radius: 20px;
      }
    }
  }
  .shop-bar{
    background: white;
    padding: 0 6px;
    margin-top: 10px;
    border-radius: 7px;
    .order-row{
      padding: 7px 10px 8px 10px;
      justify-content: space-between;
      .img-box{
        img{
          border-radius: 10px;
        }
      }
      .shop-content{
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 80px;
        .hint-box {
          display: flex;
          justify-content: space-between;
          font-size: 12px;
          align-items: center;
          &>span:nth-child(1) {
            color:#f00
          }
          &>span:nth-child(2) {
            color: #fff;
            width: 30rpx;
            height: 30rpx;
            background: #aaa;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
          }
        }
      }
      /deep/ .van-stepper__input-wrapper{
        height: 16px;
        width: 59px;
        font-size: 11px;
        color: #333;
        background: #f5f5f5;
      }
      /deep/ .van-stepper__minus,
      /deep/ .van-stepper__plus{
        height: 16px;
        width: 16px;
        color: #333;
        background: #f5f5f5;
        margin: 0 5px;
      }
    }
    .line-1{
      line-height: 1.4;
    }
    .line-2 {
      line-height: 1.4;
      height: unset;
    }
  }
  .box-layout{
    border-radius: 7px;
    background: white;
    margin-top: 13px;
    font-size: 15px;
    padding: 0 16px;
  }
  .coupon-box{
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    .usable-coupon{
      height: 23px;
      line-height: 23px;
      color: white;
      font-size: 13px;
      background-color: #EC3B1F;
      padding: 0 8px;
    }
    .font-color-r{
      color: #EC3B1F;
    }
  }
  .remark-box{
    height: 50px;
    input{
      text-align: left;
    }
  }
  .amount-box{
    padding: 18px 16px 15px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    line-height: 1;
  }
  .relation-bar{
    border-radius: 7px;
    background: white;
    margin-top: 8px;
    padding: 12px 8px;
    .relation-phone{
      padding: 5px 13px 5px 11px;
      border: 1px solid #ededed;
      border-radius: 20px;
    }
    .img-box{
      border-radius: 50%;
      background: yellow;
      border-radius: 50%;
      overflow: hidden;
    }
  }
  .hint-bottom-box {
    position: fixed;
    bottom: 54px;
    left: 0;
    background: #FDEAE5;
    font-size: 12px;
    color: #797979;
    width: 100%;
    box-sizing: border-box;
    padding: 5px;
    z-index: 10;
    span {
      color: #EC3B1F;
    }
  }
  .total-bar{
    background: white;
    position: fixed;
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px 10px 0px 0px;
    left: 0;
    bottom: 0;
    z-index: 9;
    .confirm-btn{
      border-radius: 20px;
      line-height: 1;
      height: 38px;
      width: 112px;
      font-size: 14px;
      background: #ff243d;
      color: #fff;
      &.notSupportSty{
        background: #dddddd;
        color: #fff;
      }
      &::after{
        border: unset;
      }
    }
  }
  .mask-layer{
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    box-sizing: border-box;
    width: calc(100% + 28px);
    margin-left: -14px;
    background-color: rgba(0, 0, 0, .5);
    z-index: 31;
  }
  .action-wrap{    
    .action-main{
      padding: 12px 15px 6px;
      box-sizing: border-box;
      background-color: #fff;
      // min-height: 100%;
    }
    .list{
      .unusable-title{
        text-align: center;
        line-height: 1;
        font-size: 13px;
      }
      &__item{
        width: 345px;
        border-radius: 8px;
        display: flex;
        &.grayscale{
          filter: grayscale(100%);
        }
      }
      &__wrap{
        position: relative;
        width: 100%;
        min-height: 115px;
        // filter: drop-shadow(0px 0px 10px rgba(155, 155, 155, 0.11));
      }
      &__coupon-circle-t{
        position: absolute;
        left: 95px;
        top: -6px;
        z-index: 5;
      }
      &__content{
        display: flex;
        width: 100%;
        height: 109px;
        // background: radial-gradient(circle at right top, transparent 6px, #fff 0) top left / 105px 51% no-repeat,
        //   radial-gradient(circle at right bottom, transparent 6px, #fff 0) bottom left / 105px 51% no-repeat,
        //   radial-gradient(circle at left top, transparent 6px, #fff 0) top right / 241px 51% no-repeat,
        //   radial-gradient(circle at left bottom, transparent 6px, #fff 0) bottom right / 241px 51% no-repeat;
        // filter: drop-shadow(0px 0px 10px rgba(155, 155, 155, 0.11));
        background: #fff;
        border-radius: 8px;
        position: relative;
        box-shadow: 0px 0px 5px 0px rgba(155, 155, 155, 0.2);
        z-index: 1;
        &::before{
          content: "";
          width: 12px;
          height: 12px;
          border-radius: 50%;
          background: #fff;
          position: absolute;
          top: -6px;
          left: 98px;
        }
        &::after{
          content: "";
          width: 12px;
          height: 12px;
          border-radius: 50%;
          background: #f9f9f9;
          position: absolute;
          bottom: -6px;
          left: 98px;
          // transition: all 0.5s;
        }
      }
      &__content--expend{
        &::after{
          content: "";
          background: #fff;
        }
      }
      &__border{
        width: 4px;
        height: 115px;
        position: relative;
        left: 0;
        top: 0;
        background-color: @light-orange;
      }
      &__left{
        display: flex;
        border-radius: 8px 0 0 8px;
        overflow: hidden;
      }
      &__coupon-wrap{
        background: linear-gradient(128deg, #FF5C42, #ff7761);
        width: 104px;
        height: 100%;
        color: white;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        line-height: 1;
      }
      &__arrow--bottom{
        position: absolute;
        bottom: 5px;
        right: 10px;
      }
      &__coupon-price{
        display: flex;
        align-items: flex-end;
      }
      &__price{
        font-size: 36px;
        font-weight: bold;
      }
      &__price-small{ 
        font-size: 24px;
      }
      &__price-small-m{ 
        font-size: 18px;
      }
      &__right{
        padding: 0 14px 0 15px;
        height: 100%;
        display: flex;
        justify-content: space-between;
      }
      &__coupon-content{
        line-height: 1;
        height: 100%;
        width: 150px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
      }
      &__collect--no{
        // width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      &__expend{
        background: #f5f5f5;
        margin-left: 4px;
        width: calc(100% - 4px);
        border-radius:  0 0 8px 8px;
        margin-top: -8px;
        // height: 0px;
        overflow: hidden;
        line-height: 1;
        transition: all .5s;
        position: relative;
      }
      &__ul{
        font-size: 12px;
        padding: 0 10px;
        line-height: 1;
        margin-top: 23px;
        li{
          display: flex;
          align-items: center;
          margin-bottom: 9.5px;
          &:last-child{
            margin-bottom: 13px;
          }
          .round-point{
            width: 3px;
            height: 3px;
            border-radius: 50%;
            background-color: #333333;
            margin-right: 5px;
          }
        }
      }
      .coupon-explain{
        padding: 15px 0 12px;
        line-height: 1;
        font-size: 12px;
      }
    }
    .unusable-list{
      color: #999999 !important;
      .list__coupon-wrap{
        color: #999999;
        background: unset;
      }
      .list__coupon-circle-t{
        display: none;
      }
      .list__content{
        // box-shadow: 0 0 0;
        &:before{
          display: none;
        }
      }
      .list__border{
        background-color: #cccccc;
      }
      .list__ul{
        color: #333333;
      }
    }
  }
}
.radio{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #c9c9c9;
  position: relative;
  top: calc(50% - 10px);
}
.radio--check{
  background: #ff593e;
  border: 1px solid #ff593e;
  font: normal normal normal 14px/1 vant-icon;
  text-align: center;
  line-height: 18px;
  &::before{
    content: "\F0C8";
    color: white;
  }
}
</style>
